package springdb.springdb.mapper;

        import org.apache.ibatis.annotations.*;
        import org.apache.ibatis.type.MappedJdbcTypes;
        import springdb.springdb.bean.Department;

/**
 * @Auther: luzhanshi
 * @Date: 2021/3/6 - 03 - 06 - 5:56 
 * @Description: springdb.springdb.mapper
 * @version: 1.0
 */
//指定这是一个操作数据库的mapper
//@Mapper
public interface DepartmentMapper {

    @Select("select * from department where id=#{id}")
    public Department getDeptById(Integer id);

    @Delete("delete from department where id=#{id}")
    public int deleteDeptById(Integer id);

    @Options(useGeneratedKeys = true, keyProperty = "id")//useGeneratedKeys:指明主键自增；keyProperty：指明主键字段
    @Insert("insert into department(departmentName) values(#{departmentName})")
    public int insertDept(Department department);

    @Update("update department set departmentName=#{departmentName} where id=#{id}")
    public int updateDept(Department department);
}